﻿/// <reference path="../Turbo/Turbo.js" />
/// <reference path="FileUpload.js" />
/// <reference path="FileUploadContext.js" />

TA.Turbo.Common._save_DoPostBack_Perform = TA.Turbo.Common._DoPostBack_Perform;
TA.Turbo.Common._DoPostBack_Perform = function _DoPostBack_Perform(eventTarget, eventName, eventArgument, scenario, callBackFunction)
{
	// we need to make sure all file uploads are submitted
	var fileUploadObjects = new Array();
	if (scenario == null)
	{ // go thru all file uploads on the page
		for (var id in $FileUpload.Instances)
		{
			fileUploadObjects.push($FileUpload.Instances[id]);
		}
	}
	else
	{
		for (var i = 0; i < scenario.PostControls.length; ++i)
		{
			var pc = scenario.PostControls[i];
			if (_____a)
				pc = new $PostControl();
			if (pc.get_Control() != null &&
				pc.get_Control().get_Object != null &&
				pc.get_Control().get_Object() instanceof $FileUpload)
			{
				fileUploadObjects.push(pc.get_Control().get_Object());
			}
		}
	}
	new $FileUploadContext().Start(fileUploadObjects, function FileUploadContext_CallBack()
	{
		TA.Turbo.Common._save_DoPostBack_Perform(eventTarget, eventName, eventArgument, scenario, callBackFunction);
	});
}